﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.IO;
using System.Text;
using WeChat.Common;

namespace WeChat
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class AlipayResultNotify : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            Stream stream = context.Request.InputStream;
            int len = (int)stream.Length;
            byte[] inputbytes = new byte[len];
            stream.Read(inputbytes, 0, len);
            stream.Close();
            string data = Encoding.GetEncoding("utf-8").GetString(inputbytes);
            LogHelper log = new LogHelper(AppDomain.CurrentDomain.BaseDirectory + "/log/log.txt");
            log.WriteLine("alipay回调页面接收信息：" + data);

            context.Response.ContentType = "text/plain";
            context.Response.Write("Success");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
